package com.sh.data.engine.domain.integration.datasource.model.mapper;

import com.sh.data.engine.domain.integration.datasource.model.domain.DataSourceDetailDomain;
import com.sh.data.engine.domain.integration.datasource.model.param.DataSourceInfluxDBSaveParam;
import com.sh.data.engine.domain.integration.datasource.model.param.DataSourceIotDBSaveParam;
import com.sh.data.engine.domain.integration.datasource.model.param.DataSourceRdbmsSaveParam;
import com.sh.data.engine.repository.dao.integration.datasource.entity.DataSourceEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * @author: mengzheng.mhc
 * @date: 2024/6/5 13:46
 */
@Mapper(componentModel = "spring")
public interface RdbmsConfigMapper {

    DataSourceEntity.RdbmsConfig paramToConfig(DataSourceRdbmsSaveParam param);

    DataSourceEntity.RdbmsConfig paramToConfig(DataSourceIotDBSaveParam param);

    DataSourceDetailDomain.RdbmsConfig entityToDomain(DataSourceEntity.RdbmsConfig config);

    @Mapping(source = "param.orgName", target = "schema")
    @Mapping(source = "param.apiToken", target = "password")
    DataSourceEntity.RdbmsConfig paramToConfig(DataSourceInfluxDBSaveParam param);
}
